<link rel="stylesheet" href="../addons/jy_aligroup/custom/templates/mobile/css/style.css" />
<style>
.lynn_fightgroups_span strong.fl p,.lynn_fightgroups_span strong.fl b {
    margin: 0 0.2rem;
}
</style>
<div class='fui-page creditshop-detail-page'>
	<div class="jy2-headertopbg">
			<div class="fui-header" style="background:none">
				<div class="fui-header-left">
					<a class="back" style="color:#fff" href="javascript:" ng-click="goback()"></a>
				</div>
				<div class="title bold" style="font-size:1rem;color:#fff">拼团操作</div>
			</div>
	 </div>
	<div class='fui-content jy2-headertop'>
		<div class="lynn_opengroups_head fui-list" style="background:none">
			<a href="javascript:;" ng-click="access_json('jy_aligroup/goods//id='+pagedata.goods.id)" class="lynn_index_list_a fui-list-media">
				<img ng-src="{{tomedia(pagedata.goods.image)}}" alt="{{pagedata.goods.title}}">
			</a>
			<div class="fui-list-inner lynn_opengroups_head_goods">
				<div class="text" style="font-size:0.8rem">{{pagedata.goods.title}}</div>
				<div class="subtitle">{{pagedata.goods.subtitle}}</div>
				<div class="lynn_opengroups_head_goods_info">
					<span class="fl">
					{{pagedata.group.groupnum}}人团：¥ <strong>{{pagedata.goods.groupsprice}}</strong>/{{ifelse(pagedata.goods.units,pagedata.goods.goodsnum+pagedata.goods.units,'1件')}}
					</span>
					<span class="fr">
						已有<b>{{pagedata.goods.fightnum}}</b>人参团
					</span>
					<div style="clear:both;"></div>
				</div>
			</div>
		</div>
		<div class="lynn_fightgroups">
			<div class="lynn_fightgroups_head">以下小伙伴正在发起拼团，您可以直接参加</div>
			<ul ng-if="pagedata.list.length" class="lynn_fightgroups_list">
				<li ng-repeat="item in pagedata.list">
					<img ng-src="{{item.header.avatar}}" alt="{{item.header.nickname}}">
					<span class="lynn_fightgroups_span row">
						<strong class="fl" ng-init="tool.time_down(pagedata.times[item.id])">
							<p>{{ifelse(item.header.nickname,item.header.nickname,'匿名')}}</p>
							<b>剩余：<i>{{pagedata.times[item.id].hour}}:{{pagedata.times[item.id].minite}}:{{pagedata.times[item.id].second}}</i></b>
						</strong>
						<strong class="fr">
							还差<b>{{item.num}}</b>人成团
						</strong>
					</span>
					<a href="javascript:;" ng-click="access_json('jy_aligroup/confirm/confirm/goodsid='+item.goodsid+'&teamid='+item.id+'&groupid='+item.groupid+'&type=groups')" class="fr">去参团</a>
				</li>
				<dt ng-if="!isnodata" class="lynn_team_list_top" ng-click="pagedata.get_list()">
						<p style="background:none" >加载更多团详情 <i class="iconfont icon lynn_icon">&#xe764;</i></p>
				</dt>
			</ul>
			<div ng-if="!pagedata.list || pagedata.list.length==0" class="lynn_fight_nomarl">
				暂无相关团购
			</div>
		</div>
	</div>
</div>
<script>
scope.loading = true;  //状态标记
scope.isnodata = false;
//滚动加载
scope.tool.get_list('jy_aligroup/goods/getteams/groupid='+scope.pagedata.group.id,true,function(res){
	scope.pagedata.times=res.times;
});
scope.pagedata.get_list=function(){
	scope.tool.get_list('jy_aligroup/goods/getteams/groupid='+scope.pagedata.group.id,'',function(res){
		if(!Array.isArray(res)){
				var times=res.times?res.times:[]
				if(times.length==0){
					scope.isnodata=true;
					scope.message('没有更多了！');
				}else{
					for(var key in times){
						scope.pagedata.times[key]=times[key];
					}
				}
				scope.$evalAsync();
		}		
	});
}
</script>